import numpy as np
from sklearn.model_selection import train_test_split
x=np.array([[182],[178],[170],[168],[165],[162],[158],[154],[149],[144],[173]])
y=np.array([[113],[105],[86],[83],[86],[74]])
x_train,x_test,y_train,y_test = train_test_split(x,y,test_size=0.3,random_state=0)
from sklearn.neighbors import KNeighborsClassifier
k_range =range(2,8)
k_error =[]
for k in k_range:
    model = KNeighborsClassifier(n_neighbors=k)
    model.fit(x_train,y_train)
    scores = model.cross(x_test,y_test)
    k_error.append(1 - score)
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = 'Simhei'
plt.plot(k_range,k_error,'r-')
plt.xlabel('k值')
plt.ylabel('预测误差率')
plt.show()

model = KNeighborsClassifier(3)
modle.fit(x_train,y_train)

model = KNeighborsClassifier
model.fit(x_train,y_train)
plt.xlabel('cm')
plt.ylabel('kg')
plt.axis([140,190,40,140])
plt.scatter(x,y,s=60,c='k',marker='o')
plt.plot(x,model.predict(x),'r-')
plt.show
pred = model.predict(([195]))
print(f'{pred[0],[0]}')